package org.jeecg.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.jeecg.domain.Collect;
import org.jeecg.domain.Goods;

import java.util.List;

@Mapper
public interface CollectMapper {

    @Insert("insert into collect (id,username,good_id,create_time) values (#{id},#{username},#{goodId},#{createTime});")
    Integer insertColect(Collect collect);

    @Delete("delete from collect where username = #{username} and good_id = #{goodId};")
    Integer cancelCollect(String username,String goodId);

    @Select("select g.* from collect c,goods g where g.id = c.good_id and c.username = #{username}")
    List<Goods> queryGoodsByUsername(String username);

    @Select("select * from collect where username = #{username} and good_id = #{goodId}")
    Collect queryCollect(String username,String goodId);

}
